package util

import (
	"errors"
	"fmt"
	"net"
	"os"
)

func DomainNameResolution(domain string) (string, error) {
	ns, err := net.LookupHost("domain")
	if err != nil {
		fmt.Fprintf(os.Stderr, "Err: %s", err.Error())
		return "", err
	}

	if len(ns) > 1 {
		return "", errors.New("域名解析出多个")
	}

	return ns[0], nil
}
